package org.bot.plugin.data.event;

import org.bot.api.event.DataStorage;
import org.bot.api.event.EventName;
import org.bot.api.event.Events;
import org.bot.api.flow.FlowJudgeType;
import org.bot.api.flow.FlowNode;
import org.springframework.stereotype.Component;

/**
 * @Author: 沧月
 * @Date: 2024/7/4 23:47
 * @Description: 描述
 */

@Component
@EventName("判断是否为空")
public class DataIsNull implements Events {
    @Override
    public Object exec(FlowNode node, DataStorage data) {
        if (data.get(node.getDataIndex()) == null){
            return FlowJudgeType.YES.toString();
        }else{
            return FlowJudgeType.NO.toString();
        }
    }
}
